class ValidForm{
	constructor(phone,passWord,repwd){//constructor是一个构造方法，用来接收参数
        this.phone = phone;//this代表的是实例对象
		this.passWord = passWord;
		this.repwd = repwd;
		return this;
    }
	validPhoneNum(phone){
		let reg = /^(13[0-9]|14[579]|15[0-3,5-9]|16[6]|17[0135678]|18[0-9]|19[89])\d{8}$/;
		if (!reg.test(phone)) {
			uni.showToast({
				icon: 'none',
				title: '手机号码格式不正确'
			});
			return false;
		}else{
			return true;
		}
	}
	
	validPwd(passWord){
		let reg = /^(?!\d+$)[\da-zA-Z]*$/;
		if(!reg.test(passWord) && passWord.length >= 6){
			uni.showToast({
				icon: 'none',
				title: '请输入长度大于六位且包含数字和字母的密码'
			});
			return false;
		}else{
			return true;
		}
	}
	
	validRePwd(passWord,repwd){
		if(repwd != passWord){
			uni.showToast({
				icon:'none',
				title: '两次密码输入不正确'
			});
			return false;
		}else{
			return true;
		}
	}
}

export default ValidForm


